 function getQueryString(name) { 
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
		var r = window.location.search.substr(1).match(reg); 
		if (r != null) return unescape(r[2]); return null; 
		} 

$().ready(function(){
	var fullname={
			DOG:"Dogecoin",
			MKR:"Market",REP:"Augur",GNT:"",MYST:"",ANT:"",BAT:"",SNT:"",PAY:"",BNT:"",BTM:"",
			CREDO:"",LRC:"",MANA:"",DPY:"",STAR:"",TRX:"",BNB:"",ONG:"",VEN:"",EDOG:"",BOBx:""
			
	}

	$.ajax({
		url:"/app/token_quotation/queryAll", 
		success:function(r){
			//console.log(r);
			var data=r.list;
			$.ajax({
				url:"/sys/exchangeRate/coinlis",
				success:function(r){
					var img=r.doGet;
					for(var i=0,len=data.length,html="";i<len;i++){
						var li=data[i].tokenname;
						html+=`<li>
				            <div class="add-img"><img src='../../img/bitcoin.png' alt=""/></div>
				            <div class="add-asset-name">
				                <ul>
				                    <li>${li}</li>
				                    <li>${li}</li>
				                    <li class="choose"> <i><img src="../../img/coin-xz.png" alt=""/></i></li>
				                </ul>
				            </div>
				        </li>`;
						/*for(var key in img){
							if(li==key){
								var liItem=img[key];
								html+=`<li>
							            <div class="add-img"><img src='${liItem.image}' alt=""/></div>
							            <div class="add-asset-name">
							                <ul>
							                    <li>${liItem.symbol}</li>
							                    <li>${liItem.name}</li>
							                    <li class="choose"> <i><img src="../../img/coin-xz.png" alt=""/></i></li>
							                </ul>
							            </div>
							        </li>`;
							}
						}*/
					}
					$(".add-asset-choose").html(html);
					var address=getQueryString("address");
					
					$.ajax({
						url:"/app/token_quotation/select",
						data:{"address":address},
						success:function(r){
							if(r.code==0){
								var data=r.list;
								$(".add-asset-choose>li").map(function(){
									var str=$(this).find(".choose").prev().html();
									for(var key in data){
										if(str==data[key].tokenname){
											$(this).find(".choose").addClass("selected");
										}
									}
								})
							}
						}
						})
					
					$(".add-asset-choose").on("click","li",function(e){
						var selec=$(this).find(".choose");
						selec.hasClass("selected")?selec.removeClass("selected"):selec.addClass("selected");
					})
				}
			})
		}
	})
	
})